<template>
  <h2>store demo</h2>
  <div>商品数量：{{store.state.count}}</div>
  <div>
    <button @click="updateCount">修改数量</button>
    <button @click="asyncUpdateCount">异步修改数量</button>
    <a-button type="primary" @click="asyncUpdateCount">异步修改数量</a-button>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import {useStore} from "vuex";
const store = useStore();
let count = ref(store.state.count);
function updateCount(){
  store.commit('updateCount', 10);
}
function asyncUpdateCount(){
  store.dispatch('asyncUpdateCount', 5);
}
</script>

<style scoped>

</style>
